#include<bits/stdc++.h>
#define int long long
using namespace std;
const int p=998244353;
inline void chadd(int &x,int y){
  if((x+=y)>=p)x-=p;
}
inline int qpow(int a,int b){
  int r=1;
  while(b){
    if(b&1)(r*=a)%=p;
    (a*=a)%=p,b>>=1;
  }
  return r;
}
main(){
  freopen("length.in","r",stdin);
  freopen("length.out","w",stdout);
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  int n,k,s=1,c=0; cin>>n>>k;
  vector<int> d(n+1);
  for(int i=1;i<=n;i++)
    (s*=i)%=p;
  d[n]=qpow(s,p-2);
  for(int i=n-1;~i;i--)
    d[i]=d[i+1]*(i+1)%p;
  for(int i=n,s=1;i;i--,(s*=n)%=p)
    chadd(c,d[n-i]*s%p*qpow(i,k-1)%p);
  cout<<s*c%p<<endl;
  return 0;
}